exports.request = function(app,queryResponse,paging){
  /*
   *  刘旭东
   *  2015/3/3
   */
  //----------------------------------------运维展示--------------------------------------

  //统一支付交易总量分省占比
  app.post('/sas/OMdisplay/UpayBusinessStatistics/provincePercentage', function (req, res) {
    var data = [];
    data = queryResponse.provincePercentage;
    res.send({
      state: '10000',
      data: data
    });
  });
  //统一支付交易总量不分省占比
  app.post('/sas/OMdisplay/UpayBusinessStatistics/noprovincePercentage', function (req, res) {
    var data = [];
    data = queryResponse.unprovincePercentage;
    res.send({
      state: '10000',
      data: data
    });
  });
  //对账差异数据统计
  app.post('/sas/OMdisplay/reconciliationsAbnormal/differencesCount', function (req, res){
    var data = queryResponse.diffCount;
    res.send({
      state:'10000',
      data:data
    });
  });
  //对账文件统计
  app.post('/sas/OMdisplay/reconciliationsAbnormal/fileUnreceivedStatistic',function (req,res){
    var data = req.body.provincial === '0' ? queryResponse.fileStat : queryResponse.fileStatByProv;
    res.send({
      state:'10000',
      data:data
    });
  });
  //对账文件详情
  app.post('/sas/OMdisplay/reconciliationsAbnormal/fileUnreceivedDetail', function (req,res){
    var resBody = paging(req.body, queryResponse.fileDetail);
    res.send(resBody);
  });
  //统一支付考核查询
  app.post('/sas/OMdisplay/assessment/upayTradeQuery', function(req,res){
    var resBody = { state:'10000',data:queryResponse.upayAssessment};
    res.send(resBody);
  });
  //对省考核查询
  app.post('/sas/OMdisplay/assessment/provincialQuery', function(req,res){
    var resBody;
    if(req.body.businessLineCode !== '001' || req.body.businessLineCode !== '003'){
      resBody = { state:'10000',data:queryResponse.provAssessment};
      res.send(resBody);
    }else{
      resBody = { state:'10000',data:queryResponse.notBankProvAssess};
      res.send(resBody);
    }
    
  });

  //--------------------------------------故障定位---------------------------------------------

  //交易日志统计
  app.post('/sas/faultLocation/tradeLog/query', function (req, res) {
    var resBody = paging(req.body, queryResponse.tradeLogUpay);
    res.send({
      data: resBody.data,
      state: resBody.state
    });
  });

  //交易日志统计指标检查
  app.get('/sas/faultLocation/tradeLog/index/check',function(req, res){
    var a = (Math.random() > 0.2) ? '10000':'10003';
    res.send({state:a});
  });
  
  //故障模型
  app.post('/sas/faultLocation/model/singletonShow',function (req,res){
    var data = queryResponse.failureModel;
    res.send({
      data: data,
      state: '10000'
    });
  });

  //故障发现
  app.post('/sas/faultLocation/findFault/query',function(req,res){
    var resBody = {data:queryResponse.faultInMap,state:'10000'};
    res.send(resBody);
  });

  //故障定位
  app.post('/sas/faultLocation/positionFault/query',function(req,res){
    var data = [];
    // if(req.body.businessCode !== ''){
    //   data = queryResponse.businessInSuccessByTime.map(function(item){
    //     return {time:item.time,businessAccount:item.businessAccount};
    //   });
    // }else{
      data = queryResponse.businessInSuccessByTime;
    // }
    res.send({state:'10000',data:data});
  });


  //网络设备信息展示
  app.get('/sas/faultLocation/netDevInfoView/resourceTypeQuery',function(req,res){
    var resBody = {data:queryResponse.resourceType,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/netDevInfoView/netDevQuery',function(req,res){
    var resBody = {data:queryResponse.devResource,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/netDevInfoView/netDevInfoQuery',function(req,res){
    var resBody = {data:queryResponse.netDevInfoView,state:'10000'};
     res.send(resBody);
  });

  app.get('/sas/faultLocation/dbInfoView/dbQuery',function(req,res){
    var resBody = {data:queryResponse.dbResource,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/dbInfoView/dbInfoQuery',function(req,res){
    var resBody = {data:queryResponse.dbInfo,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/dbInfoView/dbDetailQuery',function(req,res){
    var resBody = {data:queryResponse.dbDetail,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/OMdisplay/upayQM/businessQM/tradeCompletion',function(req,res){
    var resBody = {data:queryResponse.tradeCompletion,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/OMdisplay/upayQM/businessQM/tradeStatistics',function(req,res){
    var resBody = {data:queryResponse.tradeStatistics,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/OMdisplay/upayQM/businessQM/allAbnormal',function(req,res){
    var resBody = {data:queryResponse.fullAbnormal,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/OMdisplay/upayQM/businessForm/billResult',function(req,res){
    var resBody = {data:queryResponse.billResult,state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/OMdisplay/upayQM/businessForm/tradeStatistics',function(req,res){
    var resBody = {data:queryResponse.tradeStatRepForm,state:'10000'};
    res.send(resBody);
  });
  
  app.post('/sas/faultLocation/tradeLog/index/query',function(req,res){
    var resBody = {data:queryResponse.tradeLogIndex,state:'10000'};
    res.send(resBody);
  });
  
  app.post('/sas/faultLocation/tradeLog/index/save',function(req,res){
    var resBody = {data:req.body,state:'10000'};
    res.send(resBody);
  });
  
  app.post('/sas/faultLocation/findFault/realTime',function(req,res){
    for(var i = 0,data = [];i < 60; i++){
      data.push({businessAccount:Math.round(Math.random()*100)});
    }
    var resBody = {'data':data,'state':'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/findFault/usability',function(req,res){
    var max;
    for(var i = 0,data = [];i < 48; i++){
      max = Math.round(Math.random()*65)+30;
      data.push({usabilityMin:(max-10),usabilityMax:max});
    }
    var resBody = {'data':data,'state':'10000'};
    res.send(resBody);
  });
  
  app.post('/sas/faultLocation/positionFault/phasePosition',function(req,res){
    var data = [],tempObj = {};
    var resBody = {data:[],state:'10000'};
    var nameArr = ['前置','核心','后置'];
    for(var l = 0;l<3;l++){
      data = [];
      for(var i = 0,m = 0;i<48;i++){
        m = Math.round(Math.random()*75)+20;
        tempObj = {
          time:'2015-06-06 10:30',
          usabilityMin:Math.round(Math.random()*m),
          usabilityMax:m
        };
        data.push(tempObj);
      }
      resBody.data.push(
        {phaseName:nameArr[l],data:data}
      );
    }
    res.send(resBody);
  });
  
  app.post('/sas/faultLocation/positionFault/busSucceedByIp',function(req,res){
    var data = [],tempObj = {};
    var resBody = {data:[],state:'10000'};
    for(var l = 0;l<4;l++){
      data = [];
      for(var i = 0,m = 0;i<48;i++){
        m = Math.round(Math.random()*75)+20;
        tempObj = {
          time:'2015-06-06 10:30',
          businessAccount:Math.round(Math.random()*m),
          avg:m
        };
        data.push(tempObj);
      }
      resBody.data.push(
        {ip:('192.168.0.'+(l+1)),data:data}
      );
    }
    res.send(resBody);
  });

  app.post('/sas/faultLocation/model/buildAddtion',function(req,res){
    var resBody = {state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/model/modifyBuild',function(req,res){
    var resBody = {state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/model/deleteBuild',function(req,res){
    var resBody = {state:'10000'};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/model/query',function(req,res){
    var resBody = {data:{viewData:queryResponse.modelBuild,totalCount:10},state:'10000'};
    res.send(resBody);
  });

  app.get('/sas/faultLocation/notice/query',function(req,res){
    var resBody = {state:'10000',data:queryResponse.noticeSet};
    res.send(resBody);
  });

  app.post('/sas/faultLocation/notice/add',function(req,res){
    res.send({state:'10000'});
  });
};